<template>
  <error-tip :errorCode="errorCode" v-if="errorCode" >

  </error-tip>
<div v-else>
  <div class="day">
   <day-picture :data="dayData"></day-picture>
  </div>
  <day-list :data="dayData"></day-list>
  </div>
</template>

<script>
import getData from '@/service';
import {computed,onMounted } from 'vue';
import { getNewdata } from '@/lib/unit';
import { useStore } from 'vuex';
import DayPicture from '@/components/DayPicture/DayPicture.vue';
import DayList from '@/components/DayPicture/DayList.vue';
import ErrorTip from '@/components/ErrorTip/ErrorTip.vue';
export default {
  setup(){
 const store=useStore()
    onMounted(()=>{
      const field=store.state.field
      getData(field,getNewdata(field))
   
    })
    return {
    dayData:computed(()=>store.state.dayData),
    errorCode:computed(()=>store.state.errorCode)
  }
  }, 
 components:{
  DayPicture,
  DayList,
  ErrorTip,
 }
}
</script>
<style lang="less" scoped>
    .day{
        padding: .82rem .44rem;
        box-sizing: border-box;
    }
</style>